<template>
	<view class="contain" :style="{ 'padding-top': top + 'px' }">
	<view class="flex-col page">

	  <view class="flex-col group view space-y-20">
	    <!-- <text class="self-start text_2">修改店铺信息</text> -->
	    <view class="flex-col group_2">
	      <view class="flex-col section">
	        <view class="flex-col group_3 space-y-18">






	        <view class="flex-row items-center   space-x-14">
	          <text class="font_2">店铺名称</text>
	          <view class="flex-col justify-start items-start flex-auto text-wrapper_3">

				   <text class="font_5 text_7">	<input v-model="formData.name" placeholder="请输入店铺名称"></text>
	          </view>
	        </view>
	        <view class="flex-row items-center group_4 space-x-14">
	          <text class="font_2">营业执照号</text>
	          <view class="flex-col justify-start items-start flex-auto text-wrapper_3">

							   <text class="font_5 text_7">	<input v-model="formData.number" placeholder="请输入营业执照号"></text>
	          </view>
	        </view>
	        <view class="flex-row items-center group_4 space-x-38">
	          <text class="font_2">联系人</text>
	          <view class="flex-col justify-start items-start flex-auto text-wrapper_3">

							   <text class="font_5 text_7">	<input v-model="formData.contacts" placeholder="请输入联系人"></text>
	          </view>
	        </view>
	        <view class="flex-row items-center group_4 space-x-26">
	          <text class="font_2">联系电话</text>
	          <view class="flex-col justify-start items-start flex-auto text-wrapper_3">

							   <text class="font_5 text_7">	<input v-model="formData.mobile" placeholder="请输入联系电话"></text>
	          </view>
	        </view>
	        <view class="flex-row items-center group_4 space-x-14">
	          <text class="font_2">紧急联系人</text>
	          <view class="flex-col justify-start items-start flex-auto text-wrapper_3">
							   <text class="font_5 text_7">	<input v-model="formData.emergencyContact" placeholder="紧急联系人"></text>
	          </view>
	        </view>
	       <view class="flex-row items-center group_4 space-x-2">
	         <text class="font_2">紧急联系电话</text>
	         <view class="flex-col justify-start items-start flex-auto text-wrapper_3">
	          <text class="font_5 text_7">	<input v-model="formData.emergencyMobile" placeholder="紧急联系电话"></text>
	         </view>
	       </view>

		  <view class="flex-row items-center group_4 space-x-26" @tap="openPicker">
		    <text class="font_2">所在地区</text>
		    <view class="flex-col justify-start items-start flex-auto text-wrapper_3">
		     <view class=" flex-row text_7  justify-start items-start" >
					<text class="font_5 "><input  style="width:120rpx;" v-model="formData.province" placeholder="请选择省"></text><text>></text>
					<text class="font_5 "><input  style="width:120rpx;" v-model="formData.city" placeholder="请选择市"></text><text>></text>
					<text class="font_5 "><input  style="width:120rpx;" v-model="formData.area" placeholder="请选择区"></text>
			 </view>
		    </view>
		  </view>
		<view class="flex-row items-center group_4 space-x-26" >
		  <text class="font_2">详细地址</text>
		  <view class="flex-col justify-start items-start flex-auto text-wrapper_3">
		   <text class="font_5 text_7">	<input v-model="formData.address" placeholder="请选择省市区"></text>
		  </view>
		</view>








	<!-- 	  <view class="row">
		                    <view class="nominal">所在地区</view>
		                    <view class="input selectcity" @tap="openPicker">
		                        <input placeholder="请选择省市区" disabled type="text" v-model="addressData.address" />
		                        <image src="/static/right.png" class="rights"></image>
		                    </view>
		                </view>
		                <view class="row">
		                    <view class="nominal">详细地址</view>
		                    <view class="input"><textarea style="font-size: 28upx;" v-model="addressData.moreAddres"
		                            auto-height="true" placeholder="输入详细地址" v-if="show == false"></textarea></view>
		                </view>
		                <view class="row">
		                    <view class="nominal" style="color: 666;margin-top: 10upx;">设为默认地址</view>
		                    <view class="input switch">
		                        <switch :color="colors" style="transform:scale(0.8)" @change="switchChange"
		                            :checked="addressData.isdefult == 1"></switch>
		                    </view>
		                </view> -->

			<!-- 省市区选择 province city area初始省市区设置 show:是否显示  @sureSelectArea：确认事件 @hideShow：隐藏事件-->
			<cc-selectDity :province="province" :city="city" :area="area" :show="show" @changeClick="changeClick" @sureSelectArea="onsetCity"
			    @hideShow="onhideShow"></cc-selectDity>

		<!-- 	<block  v-if="formData.type==4" >
							<text class="self-start font_6 text_8">医疗资料</text>

							<view class="flex-row items-center group_4 space-x-26" >
							  <text class="font_2">医疗证件号</text>
							  <view class="flex-col justify-start items-start flex-auto text-wrapper_3">
							   <text class="font_5 text_7">	<input v-model="formData.medicalNumber" placeholder="请选择省市区"></text>
							  </view>
							</view>


							<view class="flex-row items-center group_4 space-x-26" >
							  <text class="font_2">医疗证件照片</text>
							  <view class="flex-col justify-start items-start flex-auto ">


								 <view  @click="chooseImg('medicalPhoto',0)" class="flex-col items-center  equal-division-item space-y-26"  style="width:100%">
								  <block v-if="!medicalPhoto">
									  <image
										class="image_6"
										src="https://qiniu.ccchongya.com/chongya/images/867f1b81fceadcd701fa77097d464b9c.png"
									  />
									  <text class="font_1">上传证件照片</text>
								  </block>
								  <block v-else>
									<image class="image_11" :src="medicalPhoto" />
								  </block>
								 </view>

							   </view>

							</view>

          </block> -->









	        <text class="self-start font_6 text_8">店铺照片</text>
	        <view class="flex-row equal-division">
	          <view  @click="chooseImg('shopPhoto',0)" class="flex-col items-center section_3 equal-division-item space-y-26">

				  <block v-if="!shopPhotos[0]">
					  <image
						class="image_6"
						src="https://qiniu.ccchongya.com/chongya/images/867f1b81fceadcd701fa77097d464b9c.png"
					  />
					  <text class="font_1">上传照片</text>
				  </block>
				  <block v-else>
				  	<image class="image_11" :src="shopPhotos[0]" />
				  </block>

	          </view>
			   <view  @click="chooseImg('shopPhoto',1)" class="flex-col items-center section_4 equal-division-item space-y-26">


							<block v-if="!shopPhotos[1]">
												  <image
													class="image_6"
													src="https://qiniu.ccchongya.com/chongya/images/867f1b81fceadcd701fa77097d464b9c.png"
												  />
												  <text class="font_1">上传照片</text>
							</block>
							<block v-else>
								<image class="image_11" :src="shopPhotos[1]" />
							</block>


			   </view>
	          <view  @click="chooseImg('shopPhoto',2)" class="flex-col items-center section_4 equal-division-item space-y-26">


				<block v-if="!shopPhotos[2]">
									  <image
										class="image_6"
										src="https://qiniu.ccchongya.com/chongya/images/867f1b81fceadcd701fa77097d464b9c.png"
									  />
									  <text class="font_1">上传照片</text>
				</block>
				<block v-else>
					<image class="image_11" :src="shopPhotos[2]" />
				</block>


	          </view>
	        </view>


	      </view>




	   <!--   <view class="flex-col relative section_5">
	        <text class="self-start font_6 text_9">注册人信息</text>
	        <view class="flex-row equal-division_2">
	          <view @click="chooseImg('idcardFront',0)"  class="flex-col items-center group_5 equal-division-item_2 space-y-24">


				  <block v-if="!formData.idcardFront">
						  <text class="font_4">身份证人像面照片</text>
						  <image
							class="image_7"
							src="https://qiniu.ccchongya.com/chongya/images/16967453063888744733.png"
						  />
				  </block>
				  <block v-else>
				  	<image class="image_7" :src="formData.idcardFront" mode="heightFix" />
				  </block>




	          </view>
	          <view  @click="chooseImg('idcardEmblem',0)"  class="flex-col items-center group_6 equal-division-item_2 space-y-24">

						<block v-if="!formData.idcardEmblem">
											  <text class="font_4">身份证国徽面照片</text>
											 <image
											   class="image_7"
											   src="https://qiniu.ccchongya.com/chongya/images/16967453065366789430.png"
											 />
						</block>
						<block v-else>
						<image class="image_7" :src="formData.idcardEmblem"  mode="heightFix"/>
						</block>

	          </view>
	        </view>
	        <view class="flex-col group_7">
	          <text class="self-start font_4 text_10">注册人姓名</text>
	          <view class="flex-col justify-start items-start text-wrapper_4 view_3">
	            <text class="font_7 text_11"><input v-model="formData.realname" class="font_4 text_16" placeholder="请输入法人姓名"></text>

	          </view>
	          <text class="self-start font_4 text_12">注册人身份证号</text>
	          <view class="flex-col justify-start items-start text-wrapper_5 text-wrapper_4">
	            <text class="font_7 text_11">	<input v-model="formData.idcard" class="font_4 text_16" placeholder="请输入注册人身份证号"></text>





	          </view>
	        </view>
	      </view> -->
	    </view>
	  </view>
<!-- 	  <view class="flex-row justify-center items-center self-center section_6 space-x-10">
	    <image
	      class="image_8"
	      src="https://qiniu.ccchongya.com/chongya/images/16967453062844849443.png"
	    />
	    <text class="font_8">人脸识别认证</text>
	  </view> -->
	  <view class="flex-col group_8">
	    <text class="self-start font_2">详情描述</text>
	    <view class="flex-col justify-start items-start text-area text-wrapper_6 ">
	     	<textarea style="padding:12rpx;" v-model="formData.remark" class="font_4 text_16" placeholder="请输入备注内容"></textarea>
	    </view>

	  </view>
	  <view class="flex-row justify-center items-center group_9 space-x-8">
	    <view class="section_7">
			<view class="shrink-0 section_14" @click="agreeChange" >
				<span :class="{'select':agree}"></span>
			</view>
		</view>
	    <view class="group_10">

	      <text class="font_2 text_14" >我已阅读并同意</text>
	      <text class="font_2 text_15">《宠物运输契约条款》</text>
	    </view>
	  </view>


	  <view class="flex-col justify-start items-center relative group_16">
	  	<view class="section_25"></view>
	  	<view class="flex-col justify-center items-center text-wrapper_25 pos_5" style="width:70%;">
	  		<text class="text_19" @click="apply">提交申请</text>
	  	</view>
	  </view>


	  </view>
	</view>
	</view>
</template>
<style scoped>



.text_19 {
	color: #00000082;
	font-size: 36rpx;
	font-family: HarmonyOSSansSC;
	line-height: 33rpx;
}

.section_25 {
	background-color: #f7cd1c;
	border-radius: 232rpx;
	filter: blur(16rpx);
	width: 359rpx;
	height: 20rpx;
}

.text-wrapper_25 {
	padding: 32rpx 0 36rpx;
	background-color: #ffbd52;
	border-radius: 100rpx;
}
.image_11 {
	width: 100%;
	height: 100%;
}


.section_14 {
	background-color: #ffffff;
	border-radius: 16rpx;
	width: 32rpx;
	height: 32rpx;
	border: solid 2rpx #ffc300;
}
.section_14 .select {
	width: 20rpx;
	height: 20rpx;
	border-radius: 11rpx;
	background-color: #ffc300;
	display: block;
	margin-top: 4rpx;
	margin-left: 4rpx;
}


.page {
  padding-top: 32rpx;
  background-image: linear-gradient(180deg, #ffc300 6.5%, #ffffff 25.8%);
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100%;
}
.group {
  padding: 0 20rpx;
}

.font_1 {
  font-size: 28rpx;
  font-family: HarmonyOSSansSC;
  line-height: 26rpx;
  color: #000000a6;
}
.text {
  color: #263238;
  line-height: 21rpx;
}
.view {
  margin-top: 68rpx;
}
.space-y-20 > view:not(:first-child),
.space-y-20 > text:not(:first-child),
.space-y-20 > image:not(:first-child) {
  margin-top: 40rpx;
}
.text_2 {
  margin-left: 24rpx;
  color: #000000;
  font-size: 50rpx;
  font-family: HarmonyOSSansSC;
  font-weight: 700;
  line-height: 47rpx;
}
.group_2 {
  /* height: 3001rpx; */
}
.section {
  padding: 0 8rpx 0;
  background-color: #ffffff;
  border-radius: 20rpx;
}
.group_3 {
  padding: 48rpx 16rpx 68rpx;
}
.space-y-18 > view:not(:first-child),
.space-y-18 > text:not(:first-child),
.space-y-18 > image:not(:first-child) {
  margin-top: 36rpx;
}
.font_2 {
  font-size: 24rpx;
  font-family: HarmonyOSSansSC;
  line-height: 22rpx;
  color: #081329;
}
.text-wrapper {
  margin-left: 28rpx;
  padding: 16rpx 0;
  background-color: #ffc300;
  border-radius: 4rpx;
  width: 157rpx;
  height: 49rpx;
}
.font_3 {
  font-size: 20rpx;
  font-family: HarmonyOSSansSC;
  line-height: 18rpx;
  color: #000000;
}
.text_3 {
  line-height: 19rpx;
}
.text-wrapper_2 {
  margin-left: 12rpx;
  padding: 16rpx 0;
  background-color: #e5e5e5;
  border-radius: 4rpx;
  width: 157rpx;
  height: 49rpx;
}
.text_4 {
  line-height: 19rpx;
}
.text_5 {
  color: #666e7a;
}
.image_4 {
  width: 32rpx;
  height: 32rpx;
}
.section_2 {
	height:200px;
  margin: 0 12rpx;
/*  padding: 136rpx 0 100rpx; */
  background-color: #eff5ff;
  border-radius: 10rpx;
  border: solid 2rpx #d1e1ff;
}
.space-y-22 > view:not(:first-child),
.space-y-22 > text:not(:first-child),
.space-y-22 > image:not(:first-child) {
  margin-top: 44rpx;
}
.image_5 {
  width: 42rpx;
  height: 42rpx;
}
.font_4 {
  font-size: 28rpx;
  line-height: 26rpx;
  color: #383838;
}
.text_6 {
  color: #000000;
}
.group_4 {
  margin-top: 64rpx;
  padding: 0 16rpx;
}
.view_2 {
  margin-top: 84rpx;
}
.space-x-26 > view:not(:first-child),
.space-x-26 > text:not(:first-child),
.space-x-26 > image:not(:first-child) {
  margin-left: 52rpx;
}
.text-wrapper_3 {
  padding: 16rpx 0 24rpx;
  background-color: #cccccc29;
  border-radius: 4rpx;
  height: 64rpx;
  border: solid 0.4rpx #d9d9d9;
}
.font_5 {
  font-size: 24rpx;
  line-height: 22rpx;
  color: #a6a6a6;
}
.text_7 {
  margin-left: 16rpx;
}
.space-x-14 > view:not(:first-child),
.space-x-14 > text:not(:first-child),
.space-x-14 > image:not(:first-child) {
  margin-left: 28rpx;
}
.space-x-38 > view:not(:first-child),
.space-x-38 > text:not(:first-child),
.space-x-38 > image:not(:first-child) {
  margin-left: 76rpx;
}
.space-x-2 > view:not(:first-child),
.space-x-2 > text:not(:first-child),
.space-x-2 > image:not(:first-child) {
  margin-left: 4rpx;
}
.font_6 {
  font-size: 28rpx;
  font-family: HarmonyOSSansSC;
  line-height: 26rpx;
  font-weight: 700;
  color: #081329;
}
.text_8 {
  margin-left: 8rpx;
  margin-top: 60rpx;
  line-height: 27rpx;
}
.equal-division {
  margin-top: 52rpx;
}
.section_3 {
  flex: 1 1 208rpx;
}
.image_6 {
  width: 16rpx;
  height: 16rpx;
}
.section_4 {
  flex: 1 1 208rpx;
  margin-left: 36rpx;
}
.equal-division-item {
  padding: 56rpx 0;
  background-color: #0000000a;
  border-radius: 20rpx;
  height: 208rpx;
}
.space-y-26 > view:not(:first-child),
.space-y-26 > text:not(:first-child),
.space-y-26 > image:not(:first-child) {
  margin-top: 52rpx;
}
.section_5 {
  margin-top: -780rpx;
  padding: 48rpx 0 12rpx;
  background-color: #ffffff;
  border-radius: 10rpx;
}
.text_9 {
  margin-left: 28rpx;
  line-height: 27rpx;
}
.equal-division_2 {
  margin-top: 60rpx;
}
.group_5 {
  flex: 1 1 334rpx;
  height:192rpx;
}
.image_7 {
  width: 296rpx;
  height: 192rpx;
}
.group_6 {
  flex: 1 1 334rpx;
  margin-left: 40rpx;
}
.group_7 {
  margin-top: 84rpx;
}
.text_10 {
  margin-left: 16rpx;
}
.font_7 {
  font-size: 28rpx;
  line-height: 26rpx;
  color: #848b87;
}
.text_11 {
  margin-left: 16rpx;
}
.text_12 {
  margin-left: 16rpx;
  margin-top: 48rpx;
}
.text-wrapper_5 {
  margin-right: 8rpx;
  margin-top: 20rpx;
}
.text-wrapper_4 {
  padding: 36rpx 0;
  background-color: #f5f5f5;
  border-radius: 10rpx;
}
.view_3 {
  margin-right: 8rpx;
  margin-top: 20rpx;
}
.section_6 {
  margin-top: 80rpx;
  padding: 10rpx 0;
  background-color: #358dfa;
  border-radius: 100rpx;
  width: 540rpx;
}
.space-x-10 > view:not(:first-child),
.space-x-10 > text:not(:first-child),
.space-x-10 > image:not(:first-child) {
  margin-left: 20rpx;
}
.image_8 {
  width: 78rpx;
  height: 78rpx;
}
.font_8 {
  font-size: 36rpx;
  font-family: HarmonyOSSansSC;
  line-height: 33rpx;
  color: #ffffff;
}
.group_8 {
  margin-top: 112rpx;
  padding: 0 44rpx;
}
.text-area {
  margin-top: 28rpx;
}
.text-wrapper_6 {
  padding: 28rpx 0 160rpx;
  background-color: #f5f5f5;
  border-radius: 10rpx;
}
.text_13 {
  margin-left: 16rpx;
  color: #808080;
  line-height: 23rpx;
}
.group_9 {
/*  margin-top: 988rpx; */
padding:40rpx 0
}
.space-x-8 > view:not(:first-child),
.space-x-8 > text:not(:first-child),
.space-x-8 > image:not(:first-child) {
  margin-left: 16rpx;
}
.section_7 {
  background-color: #ffffff;
  border-radius: 16rpx;
  width: 32rpx;
  height: 32rpx;
  border: solid 2rpx #fad54de0;
}
.group_10 {
  line-height: 23rpx;
  height: 23rpx;
}
.text_14 {
  color: #000000;
  line-height: 23rpx;
}
.text_15 {
  color: #ffbd52;
  line-height: 23rpx;
}
</style>

<script>
	const API = require('@/utils/api/shops.js').default;
	const $ = require('@/utils/api.js');
	export default {
		components: {},
		props: {},
		data() {
			return {
				top: uni.getStorageSync('bartop') ? uni.getStorageSync('bartop') : 0,
				isIphonex: uni.getStorageSync('isIphonex') ? uni.getStorageSync('isIphonex') : false,
				isLogin: uni.getStorageSync('token') ? true : false,
				title:"修改店铺信息",

				titleArray:[
					"商家入驻",
					"运输入驻",
					"公益入驻",
				],
				 colors: '#f23a3a',
				medicalPhoto:'',
				  show: false,
				                province:"广东省",
				                city:"广州市",
				                area: "天河区",
				                addressData: {
				                    name: '',
				                    phone: '',
				                    address: '',
				                    moreAddres: '',
				                    isdefult: 0
				                },



				petcats:'',
				showPetCate: false,
				selected: {}, //选取的分类 ,用对象更方便存取数据
				selected_ids: {},
				selected_titles:'',
				petcatArray:[
					{
						id:1,
						title:'狗'
					},
					{
						id:2,
						title:'狗'
					},
					{
						id:3,
						title:'鼠'
					},
					{
						id:4,
						title:'龟'
					},
					{
						id:5,
						title:'鱼'
					},
					{
						id:6,
						title:'马'
					},
					{
						id:7,
						title:'其他'
					}
				],


				show_pop:false,
				isflag: true,
				agree: false,
				typIndex: 0,
				typeArray: [
					 {
						  	  id:1,
						  	  name:'个人'
						  },{
							  id:2,
							  name:'企业'
						  },{
							  id:3,
							  name:'旗舰店'
						  },{
							  id:4,
							  name:'宠物医院'
						  }
				],
				shoptypeArray: [
					 {
						  	  id:1,
						  	  name:'商铺'
						  },
						  {
							  id:2,
							  name:'运输商家'
						  },
						  {
							  id:3,
							  name:'公益'
						  }
				],
				petVolumeArray: ["小型", "中型", "大型", "都有"],
				petTypeArray: ["小狗", "小猫"],
				cageSizeArray: ["1平方", "0.5平方"],
				shuttleArray: ["上门接送", '约定地点'],
				haulMethodArray: ["宠物快车", "宠物空运", "铁路托运", "城市专线", "空调专车", "宠物客运"],
				addServiceMethodArray:['上门接宠','送宠到家','提供笼具'],
				tasteList :[1,2,3,4,5],
				formData: {
					type:0,
					shoptype:0,
					shopname:'',
					shopnumber:'',
					contacts:'',
					mobile:'',
					emergencyContact:'',
					emergencyMobile:'',
					realname:'',
					idnumber:'',


					medicalPhoto:'',
					medicalNumber:'',


					shopPhoto: ",,,",
					idcard: "",
					idcardFront:'',
					idcardEmblem:'',
					cardImg:'',
					remark:'',



						cageSize: 0,
						shuttle: 0,
						number: 1,
						jianyiCert: 1,
						insureStatus: 1,
						urgentStatus: 1,
						locateStatus: 1,
						petType: 0,
						petVolume: 0,
						expectedTime: "2023-09-29 00:00:00",


						haulMethod:0,
						addServiceMethod:0,
						},
						addressType: '',
						tyAddressTo: {},
						tyAddressFrom: {},




						currentId:0,
						scrollTop: 0,
						oldScrollTop: 0,
						vSelect:[],

			};
		},
		computed: {
			i18n() {
				return this.$t('advice')
			},
			shopPhotos() {
				if (this.formData.shopPhoto) {
					let arr = this.formData.shopPhoto.split(",")
					if (arr.length == 1) {
						arr.push("");
						arr.push("");
					}
					if (arr.length == 2) {
						arr.push("");
					}
					return arr;
				}
				return ["", "", ""]
			},
			idCards() {
				if (this.formData.idCard) {
					let arr = this.formData.idCard.split(",")
					if (arr.length == 1) {
						arr.push("");
						arr.push("");
					}
					if (arr.length == 2) {
						arr.push("");
					}
					return arr;
				}
				return ["", "", ""]
			},
		},
		mounted() {
			this.tyAddressFrom = uni.getStorageSync('tyAddressFrom');
			this.tyAddressTo = uni.getStorageSync('tyAddressTo');
		},
		onLoad(options) {
			 // if(options.shoptype){
				//  this.formData.shoptype =  options.shoptype;
			 // }else{
				//  this.formData.shoptype =  1;
				//  this.title = '修改店铺信息'
			 // }

			 // this.title  =  this.titleArray[this.formData.shoptype-1]
			 // uni.setNavigationBarTitle({
			 // 		title: this.title
			 // });
		},
		methods: {


			  openPicker() {
			                console.log('执行打开地址选择器')
			                this.show = true
			            },

			            changeClick(value, value2, value3){

			                console.log('地址选择器 = ' + value + value2 + value3);

			                this.formData.province = value;
			                this.formData.city = value2;
			                this.formData.area = value3;

			            },
			            onhideShow() {
			                this.show = false
			                console.log('执行了关闭地址选择器')
			            },
			            //选中省市区
			            onsetCity(e) {
			                let data = e.detail.target.dataset;
			                let address = data.province + data.city + data.area;
			                this.show = false
			                this.addressData.address = address
			            },
			            //
			            switchChange(e) {

			            },



			// start0
			// 获取用户信息
			 getPetCates() {
				this.loading = true;
			  	 this.$http
					.get(tags, {
					})
					.then(r => {
						this.tags = r.data;
						console.log("tags",this.tags);

						// this.dataList = this.dataList.concat(res.rows)
						// let list = []
						// this.tags.forEach(e =>{
						// 	this.rgbColor()
						// 	// console.log("rgbColor")
						// 	e.background=		this.rgbColor()
						// })

						this.loading = false;
					 this.havetags()
					})
					.catch(() => {
						this.loading = false;
					});
			},
			//选取分类
			    onSelectClassify(id) {
			      this.$set(this.selected, id, !this.selected[id]) //动态更新视图数据
						this.petcatArray.forEach(e =>{
							if(id==e.id){
								if(this.selected[id]){
									 // e.background=		this.rgbColor()
									  e.background=		"#ffbd52”"

								}else{
									 e.background=		"#f1f1f1"
								}
							}

						})



						//  //需求找到数组内偶数
						// 	let arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

						// 	let newArr = arr.filter((item, i, arr) => {
						// 	//函数本身返回布尔值，只有当返回值为true时，当前项存入新数组。
						// 	return item % 2 == 0
						// 	})
						// console.log(newArr)


						// console.log(this.selected)
						// 		console.log(typeof(this.selected))

								// const names = Object.keys(this.selected)
								//  // .filter(key)=> key.includes("Name"))
								//     .reduce((obj, key) => {
								// 			// console.log(this.selected[key])
								// 			 if (this.selected[key]== true) {
								// 			        // obj[key] = this.selected[key];
								// 							  obj[key] = key;
								// 			 }
								// 			  return obj;
								//         // return Object.assign(obj, {
								//         //   [key]: this.selected[key]
								//         // });
								//   }, {});


								//  this.selected_ids = Object.values(names)
								//  // 	console.log(typeof(this.selected_ids));
								// 	// console.log("selected_ids",this.selected_ids);
								// 	this.selected_ids = this.selected_ids.join(',')
									// console.log("selected_ids",this.selected_ids);
						// this.selected.forEach(e =>{
						// 								if(ture==e){
						// 											console.log(e)
						// 								}

						// 	})


			    },

					rgbColor() {
							let r = Math.floor(Math.random() * 256);
							let g = Math.floor(Math.random() * 256);
							let b = Math.floor(Math.random() * 256);
							let rgb = `rgb(${r},${g},${b})`;

							// return "background:" + rgb
							return "background:#ffbd52"


							// this.colorData.push("background:" + rgb)

			    },
			//重置
			onClear() {
			  // this.selected = {}

				let  that = this
				let select = [] //选择的筛选结果数组
				let select_ids = []
				let select_titles = []
				this.tags.forEach(e =>{
															console.log(e.id)
															if('that.tags[i].id',that.haveTags.includes(e.id)){
																 e.background=		that.rgbColor()
																	that.$set(that.selected, e.id, true) //动态更新视图数据
																	select.push(e)
																	select_ids.push(e.id)
																	select_titles.push(e.title)
															}else{
																	e.background=		"#f1f1f1"
																	that.$set(that.selected, e.id, false) //动态更新视图数据
															}
				})

				that.selected_ids = select_ids
				that.selected_titles =select_titles


				this.selected_ids=  this.selected_ids.join(',')
				this.petcats =  this.selected_titles.join(',')



				this.showPetCate = false;

			},
			//提交筛选
			onConfirmFiltrate() {
			  let select = [] //选择的筛选结果数组
				  let select_ids = []
					  let select_titles = []
			  const {
			    petcatArray,
			    selected,
					selected_ids,
					selected_titles
			  } = this




			  //Object.keys循环遍历对象,如果值为true,就对比所有分类数组,拿到选择的筛选数据
			  Object.keys(selected).forEach(key => {
			    if (selected[key]) {
			      for (let i = 0; i < petcatArray.length; i += 1) {
			        petcatArray[i].id == key ? select.push(petcatArray[i]) : ''
							petcatArray[i].id == key ? select_ids.push(petcatArray[i].id) : ''
							petcatArray[i].id == key ? select_titles.push(petcatArray[i].title) : ''
			      }

			    }

			  })
			  console.log(select ,"选择结果数组-----");
				this.selected_ids = select_ids
				this.selected_titles =select_titles



			  this.selected_ids=  this.selected_ids.join(',')
				this.petcats =  this.selected_titles.join(',')
				this.showPetCate = false

						this.formData.petType = this.selected_ids
						console.log('this.petcats' ,this.petcats )


			},


			// ?start1
			tabtap(item) {
			    if (!this.sizeCalcState) {
			      this.calcSize();
			    }
			    this.currentId = item.id;
			    let list = [];
			    this.slistTmp.map(sitem => {
			      if (sitem.pid === item.id) {
			        list.push(sitem);
			      }
			    });
			    this.slist = list;
			  },
			  //计算右侧栏每个tab的高度等信息
			  calcSize() {
			    let h = 0;
			    this.slist.forEach(item => {
			      let view = uni.createSelectorQuery().select('#main-' + item.id);
			      view.fields(
			        {
			          size: true
			        },
			        data => {
			          item.top = h;
			          h += data.height;
			          item.bottom = h;
			        }
			      ).exec();
			    });
			    this.sizeCalcState = true;
			  },
			  tapInfo(e) {
			    if (this.vSelect.indexOf(e) == -1) {
			      this.vSelect.push(e);
			    }
			  },














			agreeChange() {
				this.agree = !this.agree
			},
			chooseImg(type, i) {
				const self = this;
				$.uploadimg({
					success(res) {
						console.log("res.imgUrl", res.imgUrl)


						if (type == 'medicalPhoto') {
							self.formData.medicalPhoto =  res.imgUrl
						}else if (type == 'cardImg') {
							// self.$set(self.formData, "cardImg", res.imgUrl)
							self.formData.cardImg =  res.imgUrl
						} else  if(type == 'idcardFront') {
								self.formData.idcardFront =  res.imgUrl
						} else  if(type == 'idcardEmblem') {
							self.formData.idcardEmblem =  res.imgUrl
						} else if(type == 'shopPhoto') {
							let str = self.formData.shopPhoto
							let arr = str.split(",")
							arr[i] = res.imgUrl;
							str = arr.join(",")
							self.$set(self.formData, "shopPhoto", str)
						}
					}
				})
			},
			selectHaulMethod(index) {
				this.formData.haulMethod = index
			},
			selectAddServiceMethod(index) {
				this.formData.addServiceMethod = index

			},
			expectedTimechange(newval) {
				console.log('范围选:', this.datetimerange);
			},
			locateStatusChange(v) {
				if (v.detail.value) {
					this.formData.locateStatus = 1
				} else {
					this.formData.locateStatus = 0
				}
			},
			urgentStatusChange(v) {
				if (v.detail.value) {
					this.formData.urgentStatus = 1
				} else {
					this.formData.urgentStatus = 0
				}
			},
			insureStatusChange(v) {
				if (v.detail.value) {
					this.formData.insureStatus = 1
				} else {
					this.formData.insureStatus = 0
				}
			},
			jianyiCertChange(v) {
				if (v.detail.value) {
					this.formData.jianyiCert = 1
				} else {
					this.formData.jianyiCert = 0
				}
			},
			bindCageSizePickerChange: function(e) {
				this.formData.cageSize = e.detail.value
			},
			bindShuttlePickerChange: function(e) {
				this.formData.shuttle = e.detail.value
			},
			bindPetTypePickerChange: function(e) {
				this.formData.petType = e.detail.value
			},

				bindPetVolumePickerChange: function(e) {
					this.formData.petVolume = e.detail.value
				},

				bindTylePickerChange: function(e) {
					this.typIndex =  e.detail.value
					this.formData.type = this.typeArray[ e.detail.value].id
					console.log(this.formData.type)


				},
					apply() {
				const self = this;
				let postData = {
					addFormJson: JSON.stringify(this.formData),
					addressToJson: JSON.stringify(this.tyAddressTo),
					addressFromJson:JSON.stringify(this.tyAddressFrom)
				}
				if (!this.agree) {
					$.$toast("请勾选宠物运输契约条款");
					return
				}
				if (!this.isflag) {
					return
				}
				// this.isflag = false;
				$.ajax({
					url: API.merchantApply,
					data: this.formData,
					method: 'POST',
					loading: true,
					loadingText: "提交订单" + ['…'],
					success(res) {
						console.log("res",res)
						let info = res.data;
						// this.isflag = false;
						// self.go('/pages/ys/order/quote?orderNo=' + info.orderNo);
						// self.go('/pages/ys/order/entrust?orderNo=' + info.orderNo);
					},
					complete() {
						this.isflag = true;
					}
				})
			},
		},
	};
</script>
